import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useCounterStore = defineStore('counter', () => {
  const count = ref(0)
  const doubleCount = computed(() => count.value * 2)
  // 在bending存储stores, 无法直接进入购物车时,获取数量
  // 准确数据应该来自于库中
  function increment() {
    count.value++
  }

  return { count, doubleCount, increment }
})
